<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/11/11
  Time: 9:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="/static/js/jquery-3.6.0.js" type="text/javascript" charset="UTF-8"></script>
    <title>Title</title>
</head>
<body>
<div>
学号：<input type="text" name="sno" id="sno">
<input type="button" id="btn" value="查找">
</div>
<script>
    $(function () {
// alert("aa");
        $("#btn").click(function () {
var sno=$("#sno").val();
// alert(sno);
var student={sno:sno,sname:"a",gender:"b",birthday:"2002-2-2",major:"c"};

$.ajax({
    type:"post",
    url:"${pageContext.request.contextPath}/student/findOne",
    data:JSON.stringify(student),
    contentType:"application/json; charset=utf-8",
    dataType:"json",
    // data:JSON.stringify({"sno":sno}),


    success:function (student) {
alert(student.sname);
alert(student.birthday);
// alert("ok");
    }
});
        });

    });
</script>
</body>
</html>
